package pack0828;

import java.util.*;

public class DenoB {
    public static void a (){
        //key--value
        Map<String,String> map = new HashMap<>();
        map.put("A","aa");
        map.put("B","bb");
        map.put("C","cc");
        map.put("B","aaa");
        map.put("D","cc");
        String s1 = map.get("B");
        String s2 = map.get("C");
        String s3 = map.get("D");
        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
        int size = map.size();
        System.out.println(size);
        //遍历键值
        Set<String> keys = map.keySet();
        //遍历内容
        Collection<String> list = map.values();
        System.out.println(keys);
        System.out.println(list);
        //判断是否有这个键值
        boolean b1 = map.containsKey("A");
        //判断是否有这个内容
        boolean b2 = map.containsValue("aa");
        System.out.println(b1);
        System.out.println(b2);

        map.remove("B");
        //判断集合是否为空
        boolean b3 = map.isEmpty();
        System.out.println(b3);
    }

    public static void b(){
        Map<String,Emp> map = new HashMap<>();
        Emp e1 = new Emp(1,"aa","程序员",1822);
        Emp e2 = new Emp(4,"bb","程序员",4552);
        Emp e3 = new Emp(3,"cc","程序员",4422);
        Emp e4 = new Emp(2,"dd","程序员",5554);
        Emp e5 = new Emp(5,"ee","程序员",5652);
        map.put("A",e1);
        map.put("B",e2);
        map.put("C",e3);
        map.put("D",e4);
        map.put("E",e5);
        Collection<Emp> list = map.values();
        System.out.println(list);
        for (Emp s:list){
            System.out.println(s);
        }
    }

    public static void main(String[] args) {
        b();
    }
}
